import request from "@/utils/request";

// 获取农产品列表
export const getProductList = (params) => {
  return request.get("/product", { params });
};

// 获取所有已经上架的商品
export const getProductListOnSale = (params) => {
  return request.get("/product/getAllOnSale", { params });
};

// 获取农产品详情
export const getProductDetail = (id) => {
  return request.get(`/product/getProductById/${id}`);
};

// 添加农产品
export const addProduct = (data) => {
  return request.post("/product", data);
};

// 审核农产品
export const updateProduct = (data) => {
  return request.put(`/product`, data);
};

// 删除农产品
export const deleteProduct = (id) => {
  return request.delete(`/product/${id}`);
};
